package com.example.administrator.yunniuusedcar.view;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.PopupWindow;

import com.example.administrator.common.utils.LogUtil;
import com.example.administrator.common.utils.SharedPreUtil;
import com.example.administrator.yunniuusedcar.R;

/** 弹窗  提醒登录框
 * Created by Administrator on 2017/12/19.
 */

  public   class SpinnerView {

        public PopupWindow mPopupWindow;

//        public void onClick(View v) {
//            LayoutInflater layoutInflater = LayoutInflater.from(this);
//            View mMPpwindow = layoutInflater.inflate(R.layout.item_popilwindow_login, null);   //popupwindow
//            if (mPopupWindow == null) {
//                //创建一个弹出窗口对象
//                mPopupWindow = new PopupWindow();
//            }
//            mPopupWindow.setContentView(mMPpwindow);//设置文本内容
//            mPopupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);//设置宽度
//            mPopupWindow.setHeight(ViewGroup.LayoutParams.MATCH_PARENT);//设置高度
////        mPopupWindow.setHeight(Global.dp2px(400));//设置高度
//            mPopupWindow.setFocusable(false);//设置焦点
//            mPopupWindow.setOutsideTouchable(false);//设置外界可点击
//            mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00ffffff")));//解决安卓7.0以下的BUG
//            //设置一个与抛锚的偏移量
//            mPopupWindow.showAtLocation(mMPpwindow, Gravity.BOTTOM, 0, 0);
//            initppwindow();
//        }
//
//        private void initppwindow() {
//            final Button disagree = mMPpwindow.findViewById(R.id.btn_Cancal);  // 取消
//            Button agreement = mPopupWindow.findViewById(R.id.btn_Nowlogin);
//            disagree.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    mPopupWindow.dismiss();
//                }
//            });
//            agreement.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
////                    SharedPreUtil.saveString(getBaseContext(), "username", mUsername);
////                    SharedPreUtil.saveString(getBaseContext(), "password", mPassword);
////                    LogUtil.e("---", mUsername);
////                    LogUtil.e("---", mPassword);
////                    ToastUtil.showToast(getBaseContext(), "感谢您的信任");(
//                            disagree();
//                }
//            });
//}
        }
